home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / print / cram_v21.zip / CRAM.DOC < prev    next >
Text File  |  1990-12-31  |  8KB  |  154 lines

  1. /*
  2.  *   ------------------------------------
  3.  *   C R A M   -   the ASCII file reducer
  4.  *   ------------------------------------
  5.  *
  6.  *   CRAM  -  ASCII File Reducer  - V2.1
  7.  *   Copyright (c) 1988-90  -  Dean Tutterow  -  All Rights Reserved
  8.  *   
  9.  *   What  does  it do?   It crams as  much text  as possible onto a page
  10.  *   in  reduced format.   Using  subscript characters as  the font on an
  11.  *   Epson printer,  you  can print up to 79 characters wide and 154 rows
  12.  *   long in 2 columns.   That  works  out to  5-6 pages of  text on each
  13.  *   printed  page.   In  normal use  with  files with embedded formfeeds
  14.  *   respected, you get 4 pages of text on each printed page.
  15.  *
  16.  *   CRAM  was  written  after  I  had  printed  another  of  those  LONG
  17.  *   documentation files.  I was tired of those STACKS of listings, etc.,
  18.  *   that  gathered  dust  simply  because they  were too much trouble to
  19.  *   handle  once I printed  them.   Now  the  printed listings are small
  20.  *   enough to keep in notebooks.   As a bonus, CRAM is especially useful
  21.  *   for printing program listings.  The reduced format is just the thing
  22.  *   to show program structure and the BIG picture!
  23.  *
  24.  *   While not limited to Epson printers,  it is hardcoded for my FX-86e.
  25.  *   Of course you can provide your own setup and un-setup codes for your
  26.  *   printer, and include them in a printer setup file for CRAM to use.
  27.  *
  28.  *   USAGE:
  29.  *   
  30.  *   CRAM srcfile crammedfile [/options]
  31.  *
  32.  *   where [/options] are:
  33.  *          /COLUMN=n       with 1 ≤ n ≥ 10
  34.  *          /FF             if <FF> encountered, align to next logical page
  35.  *          /LARGE          use PICA format to get 137 characters/line
  36.  *          /PAGELENGTH=n   may vary printed page length from 1-154 lines
  37.  *          /SKIP=n         number of columns to ignore in srcfile
  38.  *          /WHITE=n        number of characters of whitespace on left of page
  39.  *   
  40.  *   The  srcfile  should  be  a  valid DOS filename;  wildcards  are not
  41.  *   accepted.   You  need  only  supply  enough  to the  option  name to
  42.  *   distinguish it from the other options, for example /C=1 and /R.
  43.  *   
  44.  *   As a daily VAX user,  I  have tried to implement the straightforward
  45.  *   command-line interface that VMS affords the user.  While the srcfile
  46.  *   and crammedfile must be in that order,  the options may be spread at
  47.  *   will along the command line.
  48.  *
  49.  *   The options are much easier understood after a few practice sessions.
  50.  *   '/COLUMN=n' is  used whenever you want more or less than the standard
  51.  *   two columns on each page.   While  normally  defaulted  to two-column
  52.  *   operation, only the first 79 characters on each line (unless some are
  53.  *   /SKIP-ped) are  visible.   '/FF' respects  embedded  formfeeds in the
  54.  *   text.   Normally off, this option moves to the next logical page when
  55.  *   encountered.   The pagelength is adjustable  through  '/PAGELENGTH=n'
  56.  *   The default is 132 rows,  which allows two pages in each column since
  57.  *   most formatters place 66 lines per page.  If you want your one-column
  58.  *   printing shifted right on the page so that you have whitespace on the
  59.  *   left  side of the page,  then '/WHITE' is just the ticket.   Finally,
  60.  *   '/SKIP=n' ignores the first 'n' characters on each line.  This allows
  61.  *   you  to  print  79  useful  characters  in each  column when printing
  62.  *   formatted files with spaces or tabs in the first 'n' columns.
  63.  */
  64.  
  65.         Helpful Hints:
  66.  
  67.         Okay, you have just un-arced one of those shiny new programs
  68.         from the bulletin-board and you have this 80,000 byte file
  69.         describing all of it's features, called 'SHINY.DOC'.  The
  70.         first thing to do is scan the file to see it's general format.
  71.         The questions to ask yourself are as follows.
  72.  
  73.         "Are there embedded formfeeds?"
  74.                 If there are then you most likely will want to use
  75.                 the '/FF' option to align the pages.
  76.  
  77.         "Is there a set page length (usally 66 lines per page)?"
  78.                 Usually if a documentation file does not have embedded
  79.                 formfeeds, then it usually has a set page length.  While
  80.                 this is usually 66 lines per page, it could be some
  81.                 oddball number like 63.  For this case you would use the
  82.                 option '/PAGELENGTH=126' so that two pages will fit in
  83.                 each column.
  84.  
  85.         "Was the file created with some carriage returns not followed
  86.         by line feeds?"
  87.                 This is the case with document processors that implement
  88.                 overstrike and other printer features in a generic manner.
  89.                 They write out a second (and possibly more) line with the
  90.                 words they want to be overstruck.  Since there is no line
  91.                 feed after the first line, the printer writes over what it
  92.                 just printed.  These type of files make CRAM sick!  Never
  93.                 fear, FILTER is here.  Included in this distribution is
  94.                 the source and executable for FILTER, a program that removes
  95.                 these subsequent lines from the document so that CRAM can
  96.                 do it's job properly.  FILTER reads from STDIN and writes
  97.                 to STDOUT.
  98.  
  99.         "What do I do with documents spaced away from the left side of
  100.         the page?"
  101.                 If 'SHINY.DOC' is formatted so that the first character
  102.                 on every line starts after some position other than 1,
  103.                 the '/SKIP=n' option will allow you to ignore those first
  104.                 'n' characters on every line.  When reading lines in,
  105.                 CRAM converts all tabs to their appropriate space repre-
  106.                 sentation so need to worry about them either.  Using this
  107.                 option would allow you to see 'n' more characters in your
  108.                 printout
  109.  
  110.         "I don't have an Epson-compatible printer, am I out of luck?"
  111.                 For those of you that do not have an Epson-compatible
  112.                 printer, you may provide your own printer initialization
  113.                 and termination streams.  Simply create a file called
  114.                 'CRAM.DAT' with two lines.  The first line should contain
  115.                 the binary initialization stream and the second line the
  116.                 binary termination stream.  It is crude but effective.
  117.                 The printer initialization string sets the line spacing to
  118.                 15/216 inch, selects superscript mode, and finally selects
  119.                 condensed mode.  The printer termination string returns
  120.                 the printer to 1/6-inch line spacing, cancels superscript
  121.                 mode, cancels condensed mode, and finally writes an
  122.                 end-of-file character.
  123.  
  124.  
  125.         I can't guarantee it, but I would wager that once you try CRAM
  126.         you will use it to print ALL your listings and documentation
  127.         files.  One nice benefit with printing in condensed superscript
  128.         mode is that no matter how bad your printer prints normally or
  129.         no matter how bad your ribbon, you WILL get a nice dark, readable
  130.         printing.  A number of people have even commented that it looks
  131.         like it came from a laser printer.
  132.  
  133.         I highly recommend using PKLITE, LZEXE, or any other executable
  134.         compressor with CRAM.  While the CRAM executable is not large,
  135.         we might as well get the benefit of these programs.  CRAM works
  136.         with both mentioned executable compressors.
  137.  
  138.         As an advocate of shareware in general and source distribution
  139.         in particular,   I am distributing  CRAM  with the stipulation
  140.         that NO  fee is charged  for the use, copying, or distribution
  141.         of CRAM.   I will gladly  accept contributions from those that
  142.         find my work of some use to them.  Please send any suggestions,
  143.         corrections, or contributions to the address given below.
  144.  
  145.         As always, this program is provided AS IS without any warranty,
  146.         ex